/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package bkt.model.person;

import bkt.model.hr.EmployeeStatus;
import bkt.model.hr.attendance.Checkin;
import bkt.model.hr.attendance.Checkout;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.*;
import org.hibernate.annotations.GenericGenerator; 

/**
 *
 * @author hashcode
 */
@Entity
public class Employee implements Serializable, Comparable<Employee>{
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(generator = "system-uuid")
    @GenericGenerator(name = "system-uuid", strategy = "uuid2")
    private String  id;
    private String empName;
    private String empSurname;
    private String empEmail;
    private String empPassword;
    private String empNumber;
    private String empFingerprint;
    private String empBarcode;


    @OneToMany(orphanRemoval = true, cascade = {javax.persistence.CascadeType.ALL})
    @JoinColumn(name = "employee_id")
    private List<Contact> contacts = new ArrayList<Contact>(); 
    
    @OneToMany(orphanRemoval = true, cascade = {javax.persistence.CascadeType.ALL})
    @JoinColumn(name = "employee_id")
    private List<EmployeeStatus> employeeStatus = new ArrayList<EmployeeStatus>(); 
    
    @OneToMany(orphanRemoval = true, cascade = {javax.persistence.CascadeType.ALL})
    @JoinColumn(name = "employee_id")
    private List<Identification> Identifications = new ArrayList<Identification>(); 
    
   @OneToMany(orphanRemoval = true, cascade = {javax.persistence.CascadeType.ALL})
    @JoinColumn(name = "employee_id")
    private List<Name> Names = new ArrayList<Name>(); 
   
   @OneToMany(orphanRemoval = true, cascade = {javax.persistence.CascadeType.ALL})
    @JoinColumn(name = "employee_id")
    private List<Checkin> checkins = new ArrayList<Checkin>(); 
   
   @OneToMany(orphanRemoval = true, cascade = {javax.persistence.CascadeType.ALL})
    @JoinColumn(name = "employee_id")
    private List<Checkout> checkouts = new ArrayList<Checkout>(); 
   
   private Demographic  demographic = new Demographic();

    public List<Checkin> getCheckins() {
        return checkins;
    }

    public void setCheckins(List<Checkin> checkins) {
        this.checkins = checkins;
    }

    public List<Checkout> getCheckouts() {
        return checkouts;
    }

    public void setCheckouts(List<Checkout> checkouts) {
        this.checkouts = checkouts;
    }

    public List<Identification> getIdentifications() {
        return Identifications;
    }

    public void setIdentifications(List<Identification> Identifications) {
        this.Identifications = Identifications;
    }

    public List<Name> getNames() {
        return Names;
    }

    public void setNames(List<Name> Names) {
        this.Names = Names;
    }

    public List<Contact> getContacts() {
        return contacts;
    }

    public void setContacts(List<Contact> contacts) {
        this.contacts = contacts;
    }

    public Demographic getDemographic() {
        return demographic;
    }

    public void setDemographic(Demographic demographic) {
        this.demographic = demographic;
    }

    public String getEmpEmail() {
        return empEmail;
    }

    public void setEmpEmail(String empEmail) {
        this.empEmail = empEmail;
    }

    public String getEmpName() {
        return empName;
    }

    public void setEmpName(String empName) {
        this.empName = empName;
    }

    public String getEmpPassword() {
        return empPassword;
    }

    public void setEmpPassword(String empPassword) {
        this.empPassword = empPassword;
    }

    public String getEmpSurname() {
        return empSurname;
    }

    public void setEmpSurname(String empSurname) {
        this.empSurname = empSurname;
    }

    public List<EmployeeStatus> getEmployeeStatus() {
        return employeeStatus;
    }

    public void setEmployeeStatus(List<EmployeeStatus> employeeStatus) {
        this.employeeStatus = employeeStatus;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getEmpNumber() {
        return empNumber;
    }

    public void setEmpNumber(String empNumber) {
        this.empNumber = empNumber;
    }

    public String getEmpBarcode() {
        return empBarcode;
    }

    public void setEmpBarcode(String empBarcode) {
        this.empBarcode = empBarcode;
    }

    public String getEmpFingerprint() {
        return empFingerprint;
    }

    public void setEmpFingerprint(String empFingerprint) {
        this.empFingerprint = empFingerprint;
    }

    
    
    
    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Employee)) {
            return false;
        }
        Employee other = (Employee) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "bkt.model.person.Employee[id=" + id + "]";
    }

    @Override
    public int compareTo(Employee o) {
       return getEmpNumber().compareTo(o.empNumber);
    }


    
}
